#include "stdafx.h"
#include "flydx9.h"
#include "SpriteFloat.h"
#include "DataController.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

SpriteFloat::SpriteFloat(const vector<BaseDispSprite*>& listSprite,int nLayer,int nSpeed)
:SpriteCombined( listSprite,nLayer),m_nSpeed(nSpeed),m_nLastTime(-1)
{

}

SpriteFloat::~SpriteFloat()
{

}

bool SpriteFloat::Draw( DWORD dwCurrentTime )
{  
	if(-1!=m_nLastTime){
		m_vPosition.x += static_cast<float>(m_nSpeed) * (dwCurrentTime-m_nLastTime)/1000;

		if( m_vPosition.x > RESOLUTION_x + EXTRA_EDGE_x) m_vPosition.x = -EXTRA_EDGE_x;   
		if( m_vPosition.x < -EXTRA_EDGE_x ) m_vPosition.x = RESOLUTION_x+EXTRA_EDGE_x;  
	}
	m_nLastTime=dwCurrentTime;
	SpriteCombined::Draw(dwCurrentTime);
	return true;
}